home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / Buch / TextOut1.cpp < prev    next >
C/C++ Source or Header  |  1998-12-23  |  1KB  |  36 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "TextOut1.h"
  6. //---------------------------------------------------------------------------
  7. #pragma resource "*.dfm"
  8.  
  9. const int FMax = 16;
  10. TColor Farbe[FMax] =
  11.   {clBlack, clMaroon, clGreen, clNavy, clTeal, clPurple,
  12.    clOlive, clGray, clSilver, clRed, clLime, clBlue,
  13.    clAqua, clFuchsia, clYellow, clWhite};
  14.  
  15. TForm1 *Form1;
  16. //---------------------------------------------------------------------------
  17. __fastcall TForm1::TForm1(TComponent* Owner)
  18.     : TForm(Owner)
  19. {
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TForm1::Button1Click(TObject *Sender)
  23. {
  24.   for (int i=0; i<100; i++)
  25.   {
  26.     Canvas->Font->Color = Farbe[random(FMax)];
  27.     Canvas->Font->Height = random(50)+10;
  28.     Canvas->TextOut (random (ClientWidth),random (ClientHeight), "Hallo");
  29.   }
  30. }
  31. //---------------------------------------------------------------------------
  32. void __fastcall TForm1::FormCreate(TObject *Sender)
  33. {
  34.   randomize ();
  35. }
  36. //---------------------------------------------------------------------------